<!DOCTYPE html>
<html lang='en'>

<head>
  <meta charset='UTF-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title>Document</title>
  <script src='https://cdn.jsdelivr.net/npm/vue/dist/vue.js'></script>
</head>

<body>
  <template id="myCpn">
    <div>
      <slot name="left">我是左边</slot>
      <slot name="center">我是中间</slot>
      <slot name="right">我是右边</slot>
      <slot >我是没有名字</slot>
    </div>
  </template>

  <div id='app'>
    <h2>{{message}}</h2>
    <my-cpn></my-cpn>
    <my-cpn>
      <span slot="center">我是替换插槽的内容</span>
    </my-cpn>
    <my-cpn>
      <span>我是替换插槽的内容</span>
    </my-cpn>
  </div>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        message: 'hello world'
      },
      components: {
        myCpn: {
          template: '#myCpn'
        }
      }
    })
  </script>
</body>

</html>